#ifndef BANKSYSTEM_HH
#define BANKSYSTEM_HH
#include "Customer.hh"
#include "Transaction.hh"
#include <vector>
#include <memory>
#include <string>
#include <map>
//Singleton controller managing all customers, accounts, and reports.
namespace Bank {
    class BankSystem {
    private:
        std::vector<std::shared_ptr<Customer>> customers;
        std::vector<Transaction> allTransactions;
        int transactionCounter = 1; // For generating IDs like T001, T002
        //Private constructor (Singleton pattern)
        BankSystem() = default;
        //No copying
        BankSystem(const BankSystem&) = delete;
        BankSystem& operator=(const BankSystem&) = delete;

        std::vector<std::shared_ptr<IAccount>> accounts;
    public:
        static BankSystem& getInstance(); //Singleton Interface

        void registerCustomer(const std::string& name);
        std::shared_ptr<Customer> findCustomer(const std::string& name);
        void displayAllAccounts() const;
        void recordTransaction(const Transaction& tx);
        void generateGlobalReport() const;
        void accessCustomerAccounts();
        void handleCustomerRegistration();

        const std::vector<std::shared_ptr<Customer>>& getAllCustomers() const;
        std::vector<std::shared_ptr<IAccount>> findAccountsByOwner(const std::string& ownerName);
        const std::vector<Transaction>& getAllTransactions() const;
        std::vector<Transaction> getTransactionsForAccount(const std::string& accountId) const;
        std::shared_ptr<IAccount> findAccountById(const std::string& accountId) const;

        void generateAccountReport(const std::string& accountId) const;
    };

}

#endif
